package handler

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
)

func InitRoutes(db *gorm.DB) *gin.Engine {
  router := gin.New()

  auth := router.Group("/auth") 
  {
    auth.POST("/sign-up", func (c *gin.Context) {
      signUp(c, db) 
    })

    auth.POST("/sign-in", func (c *gin.Context) {
      signIn(c, db)
    })
  } 


  api := router.Group("/api", userIdentity)
  {
    events := api.Group("/events")
    {
      events.GET("/", func (c *gin.Context) {
        id, _ := c.Get(userCtx)
        c.JSON(http.StatusOK, map[string]interface{}{
          "id": id,
        })
      })

      events.GET("/:event_id", func (c *gin.Context) {
      })

      events.POST("/", func (c *gin.Context) {
      })

      events.PUT("/:event_id", func (c *gin.Context) {
      })

      events.DELETE("/:event_id", func (c *gin.Context) {
      })

      comments := events.Group(":event_id/comments")
      {
        comments.GET("/", func (c *gin.Context) {
        })

        comments.POST("/", func (c *gin.Context) {
        })

        comments.PUT("/:comment_id", func (c *gin.Context) {
        })
        
        comments.DELETE("/:comment_id", func (c *gin.Context) {
        })
      }
    }

    users := api.Group("/users")
    {
      users.GET("/:user_id", func (c *gin.Context) {
      })

      users.PUT("/:user_id", func (c *gin.Context) {
      })

      users.DELETE("/:user_id", func (c *gin.Context) {
      })
    }
  }
  
  router.GET("/", func (c *gin.Context) {
  })

  return router
}
